package dfbz.homework06;

public class MyThread implements Runnable {
    private static Integer cup = 100;
    private static Object obj=new Object();
    @Override
    public void run() {
        while (true){
            demo01();
        }
    }

    private static  void demo01() {
        synchronized (obj) {
            if (cup > 0) {
                System.out.println(Thread.currentThread().getName() + "正在售出第" + (100-cup+1) + "个杯子，" + "还剩余" + (--cup) + "个");
            }
        }
    }
}
